package com.ruoyi.toobit.task;

import com.ruoyi.spot.openapi.kline.controller.SpotOpenapiKlineController;
import com.ruoyi.spot.openapi.kline.domain.VO.SpotOpenapiKlineVO;
import com.ruoyi.spot.openapi.kline.service.ISpotOpenapiKlineService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 现货K线监控任务：遍历数据库币对，调用 /quote/v1/klines 校验字段。
 * 调用目标：spotKlineMonitorTask.execute()
 */
@Component("spotKlineMonitorTask")
public class SpotKlineMonitorTask {

    private static final Logger logger = LoggerFactory.getLogger("sys-info");

    @Autowired
    private ISpotOpenapiKlineService spotOpenapiKlineService;

    @Autowired
    private SpotOpenapiKlineController spotOpenapiKlineController;

    public void execute() {
        logger.info("⏰ [SpotKlineMonitorTask] 开始K线字段监控...");
        // 复用现有控制器逻辑：其内部会从库读取币对、请求 /quote/v1/klines 并校验入库与告警
        spotOpenapiKlineController.SpotOpenapiKline();
        logger.info("✅ [SpotKlineMonitorTask] 完成K线字段监控");
    }
}


